package com.hongye.house.service.impl;

import java.util.List;

import com.hongye.common.core.exception.ServiceException;
import com.hongye.common.core.web.page.TableDataInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hongye.house.mapper.HouseResourceMapper;
import com.hongye.house.domain.HouseResource;
import com.hongye.house.service.IHouseResourceService;

/**
 * 房源列表Service业务层处理
 * 
 * @author fafa
 * @date 2025-02-14
 */
@Service
public class HouseResourceServiceImpl implements IHouseResourceService 
{
    @Autowired
    private HouseResourceMapper houseResourceMapper;

    /**
     * 查询房源列表
     * 
     * @param houseId 房源列表主键
     * @return 房源列表
     */
    @Override
    public HouseResource selectHouseResourceByHouseId(Long houseId)
    {
    if (houseId == null) {
        throw new ServiceException("房源ID不能为空");
    }
        return houseResourceMapper.selectHouseResourceByHouseId(houseId);
    }

    /**
     * 查询房源列表列表
     * 
     * @param houseResource 房源列表
     * @return 房源列表
     */
    @Override
    public List<HouseResource> selectHouseResourceList(HouseResource houseResource)
    {
        return houseResourceMapper.selectHouseResourceList(houseResource);
    }

    /**
     * 新增房源列表
     * 
     * @param houseResource 房源列表
     * @return 结果
     */
    @Override
    public int insertHouseResource(HouseResource houseResource)
    {
        return houseResourceMapper.insertHouseResource(houseResource);
    }

    /**
     * 修改房源列表
     * 
     * @param houseResource 房源列表
     * @return 结果
     */
    @Override
    public int updateHouseResource(HouseResource houseResource)
    {
        return houseResourceMapper.updateHouseResource(houseResource);
    }

    /**
     * 批量删除房源列表
     * 
     * @param houseIds 需要删除的房源列表主键
     * @return 结果
     */
    @Override
    public int deleteHouseResourceByHouseIds(Long[] houseIds)
    {
        return houseResourceMapper.deleteHouseResourceByHouseIds(houseIds);
    }

    /**
     * 删除房源列表信息
     * 
     * @param houseId 房源列表主键
     * @return 结果
     */
    @Override
    public int deleteHouseResourceByHouseId(Long houseId)
    {
        return houseResourceMapper.deleteHouseResourceByHouseId(houseId);
    }

    /****
     * @Author Ms.发发
     * @Description 排序方式  获取列表数据
     * @param sortType [综合排序,租金从高到低,租金从低到高]
     */
    @Override
    public List<HouseResource> selectHouseResourceListBySort(String sortType) {
        if(sortType == null || sortType.equals("")){
            throw new ServiceException("排序方式不能为空");
        }
        return houseResourceMapper.selectHouseResourceListBySort(sortType);
    }
}
